package com.nsn.auction.dao.impl;

import java.util.List;

import com.nsn.auction.dao.CategoryDao;
import com.nsn.auction.domina.Category;
import com.nsn.auction.util.CustomHibernateDaoSupport;

public class CategoryDaoImpl extends CustomHibernateDaoSupport implements CategoryDao{

	@Override
	public void save(Category category) {
		getHibernateTemplate().save(category);
		
	}

	@Override
	public void update(Category category) {
		getHibernateTemplate().update(category);
		
	}

	@Override
	public void delete(Category category) {
		getHibernateTemplate().delete(category);
		
	}

	@Override
	public Category findCategoryById(Long categoryId) {
		List<Category> list = getHibernateTemplate().find("from Category where categoryId=?", categoryId);
		if (list.size() == 0)
			return null;
		else
			return list.get(0);
	}
	

}
